<?php
$messages = $moduleData['Messages'];
?>
<div id="shoutbox">
	<?php 
	$count = 0; 
	if(!empty($messages))
	{
		foreach($messages as $message): 
		?>
		<div class="sbmessage <?php echo ($count % 2) ? "one" : "two"; ?>">
			<span>
				<b><?php echo $message['Message']['name'] ?>: </b>
				<?php echo (empty($message['Message']['website'])) ? "" : "<a href=\"{$message['Message']['website']}\" onclick=\"window.open(this.href);return false;\">[website]</a>"; ?>
				<small><?php echo $message['Message']['date']; ?></small>
				<?php echo $message['Message']['body']; ?>
			</span>
		</div>
		<?php $count++ ?>
		<?php 
		endforeach; 
	}
	echo ($count == 0) ? "<p>Er zijn nog geen berichten</p>" : "" 
	?>
	<div class="pages">
		<?php echo ($moduleData['previous'] > 0) ? "<a href=\"?pagina={$moduleData['previous']}\">Vorige Pagina</a>" : "" ?>
		<?php echo ($moduleData['next'] <= $moduleData['pageCount']) ? "<a href=\"?pagina={$moduleData['next']}\">Volgende Pagina</a>" : "" ?>
	</div>
	<?php 
	echo $form->create('Message', array('action' => 'add'));
	echo $form->input('name', array('label' => 'Naam: ', 'error' => array('wrap' => 'span')));
	echo $form->input('website', array('type' => 'text', 'value' => 'http://', 'label' => 'Website: ', 'error' => true));
	echo $form->input('body', array('label' => 'Bericht: ', 'rows' => '3', 'error' => true));
    echo $form->input('check', array('type' => 'hidden'));
	echo $form->end('Plaats');
	?>
</div>
